/*
 * @Description: api
 * @Author: huacong
 * @Date: 2020-05-11 16:16:44
 * @LastEditTime: 2020-09-14 15:17:04
 * @LastEditors: huacong
 */
import { axios } from '@/utils/http/request'
import { makeFormData } from '@/utils/util'

// get请求
export function httpGet (url, params, data) {
  return axios({
    url: url,
    params,
    data,
    method: 'GET'
  })
}

// post请求
export function httpPostData (url, params, data, formDataFlag) {
  if (formDataFlag) {
    const formData = new FormData()
    makeFormData(data, formData)
    data = formData
  }
  return axios({
    url: url,
    params,
    data,
    method: 'POST'
  })
}

const api = {
  getPara: '/public/getPara'
}

export function getPara (params) {
  return axios({
    url: api.getPara,
    params,
    method: 'GET'
  })
}

export default api
